<?php 
define('_VIEW_MODEL_','admin');
session_start();
$statu = $_SESSION['statu'];
require_once("../init.php");

if(isset($page)){
		$page = intval($page);
	}else{
		$page = 1;
	}
$stat = ($page-1)*$adminusernum;
$num  = $db->GetRow("select count(id) from {$telper}friendlink");
if(!$statu){
	echo "<script>window.parent.location.href='./index.php'</script>";
}
if(isset($act)&&$act=="update"){
	$id = intval($id);
	$rank = intval($value);
	$rs = $db->Execute("update {$telper}friendlink set `rank` = '$rank' where `id` = '$id'");
	//echo "update {$telper}friendlink set `rank` = '$rank' where `id` = '$id'";
	//exit;
}
$rs = $db->Execute("select * from {$telper}friendlink order by rank desc limit $stat,10");
if(!empty($rs)){
	$friendsinfo = $rs->GetArray();
}else{
	$friendsinfo = false;
}
$pageObj = new Page($num['count(id)'],$adminusernum,$smartyObj);
$smartyObj->assign('title',$admintitle);
$smartyObj->assign('friendinfo',$friendsinfo);
$smartyObj->assign('adminfirendtitle',$adminfriendtitle);
$smartyObj->display("friends.tpl");
?>